﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0812045
{
    public class BulletSprite : BaseSprite
    {
        public BulletSprite()
        {

        }
        public BulletSprite(Texture2D[] texture2D)
        {
            _texture2d = texture2D;
            _itexture2d = 10;
            _x = 0;
            _y = 0;
        }
        public bool visible = true;
        private int _loai = 0;

        public int loai
        {
            get { return _loai; }
            set { _loai = value; }
        }

        public override void Update(GameTime gameTime)
        {
            if (_x < 0 || _y < 0 || _x > 640 || y > 480)
                visible = false;
            y -= 10 * (float)Math.Cos(Math.Abs(_itexture2d - 10) * 9 * Math.PI / 180);
            x += 10 * (float)Math.Sin((_itexture2d - 10) * 9 * Math.PI / 180);
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture2d[0], new Rectangle((int)_x, (int)_y, 24, 24), new Rectangle(_itexture2d * 24, _loai * 24, 24, 24), Color.White);
        }
    }
}
